/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package window;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JToolBar;

/**
 *
 * @author Arcanis
 */
public class AutohideMouseAdapter extends MouseAdapter {

    private JToolBar hiddenPanel;
    private JFrame frame;

    public AutohideMouseAdapter(JToolBar hiddenPanel, JFrame frame) {
        this.hiddenPanel = hiddenPanel;
        this.frame = frame;
    }

    @Override
    public void mouseMoved(MouseEvent e) {
        hiddenPanel.setVisible(e.getX() > frame.getSize().width - 35);
    }
}
